home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / src / ace / c / screen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-04  |  2.8 KB  |  124 lines

  1. /*
  2. ** <<ACE>>
  3. **
  4. ** Amiga BASIC Compiler **
  5. **
  6. ** Parser: screens **
  7. ** Copyright (C) 1998 David Benn
  8. ** 
  9. ** This program is free software; you can redistribute it and/or
  10. ** modify it under the terms of the GNU General Public License
  11. ** as published by the Free Software Foundation; either version 2
  12. ** of the License, or (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22. **
  23. ** Author: David J Benn
  24. **   Date: 16th February 1994 (code removed from statement.c)
  25. */
  26.  
  27. #include "acedef.h"
  28.  
  29. /* external */
  30. extern    int    sym;
  31.  
  32. /* functions */
  33. void    screen()
  34. {
  35. /*
  36. ** SCREEN [CLOSE|FORWARD|BACK]
  37. */
  38. int    rword,stype;
  39.  
  40.   insymbol();
  41.  
  42.   /* SCREEN CLOSE screen-id */
  43.   if (sym == closesym) 
  44.   {
  45.    insymbol();
  46.    make_sure_short(expr()); /* screen-id */
  47.    gen("move.w","(sp)+","d0");
  48.    gen("jsr","_closescreen","  ");
  49.    enter_XREF("_closescreen");
  50.    enter_XREF("_IntuitionBase");
  51.   }
  52.   else
  53.   /* SCREEN FORWARD|BACK screen-id */
  54.   if (sym == forwardsym || sym == backsym)
  55.   {
  56.     rword = sym;
  57.  
  58.     insymbol();
  59.     stype = expr();
  60.     if (stype == stringtype)
  61.         _error(4);
  62.     else
  63.     {
  64.         /* screen-id */
  65.         make_sure_short(stype);
  66.         gen("move.w","(sp)+","d0");
  67.  
  68.         /* forward or back? */
  69.         switch(rword)
  70.         {
  71.             case forwardsym : gen("move.w","#1","d1"); break;
  72.             case backsym     : gen("move.w","#2","d1"); break;
  73.         }
  74.  
  75.         gen("jsr","_change_screen_depth","  ");
  76.  
  77.         enter_XREF("_change_screen_depth");
  78.         enter_XREF("_IntuitionBase");
  79.     }
  80.   }
  81.   else
  82.   /* SCREEN screen-id,width,height,colors,mode */
  83.   {
  84.    /* open a screen */
  85.    make_sure_short(expr()); /* screen-id */
  86.    if (sym != comma) _error(16);
  87.    else
  88.    {
  89.     insymbol();
  90.     make_sure_short(expr()); /* width */
  91.     if (sym != comma) _error(16);
  92.     else
  93.     {
  94.      insymbol();
  95.      make_sure_short(expr()); /* height */
  96.      if (sym != comma) _error(16);
  97.      else
  98.      {
  99.       insymbol();
  100.       make_sure_short(expr()); /* depth */
  101.       if (sym != comma) _error(16);
  102.       else
  103.       {
  104.        insymbol();
  105.        make_sure_short(expr()); /* mode */
  106.        
  107.        /* pop parameters */
  108.        gen("move.w","(sp)+","d4"); /* mode */
  109.        gen("move.w","(sp)+","d3"); /* depth */
  110.        gen("move.w","(sp)+","d2"); /* height */
  111.        gen("move.w","(sp)+","d1"); /* width */
  112.        gen("move.w","(sp)+","d0"); /* screen-id (1-9) */
  113.  
  114.        /* open the screen */
  115.        gen("jsr","_openscreen","  ");
  116.        enter_XREF("_openscreen");
  117.        enter_XREF("_GfxBase");
  118.       }
  119.      }
  120.     }
  121.    }
  122.   }
  123. }
  124.